const http = require('http')

const server = http.createServer((req, res) => {
  res.writeHead(200, {
    'Access-Control-Allow-Origin': '*',    // 允许所有域名访问
    'access-control-allow-methods': 'GET, POST, OPTIONS,PUT, DELETE',    // 允许的请求方式
    'access-control-allow-headers': 'X-Requested-With,Content-Type'     // 允许的请求头
  })
  res.end('hello world');
})

server.listen(3000)